﻿using System.Text.RegularExpressions;

namespace Guog.Common
{
    public class FileHelper
    {
        #region 验证文件名合法
        /// <summary>
        /// 验证文件名是否合法
        /// </summary>
        /// <param name="strIn"></param>
        /// <returns></returns>
        public static bool IsValidFileName(string strIn)
        {
            bool result = false;

            if (strIn != null && strIn.Trim().Length > 0)
            {
                strIn = strIn.Trim();
                Regex regEx = new Regex("[\\*\\\\/:?<>|\"]");

                result = regEx.IsMatch(strIn);
            }

            return result;
        }

        #endregion 验证文件名合法
    }
}
